<template>
  <rx-dialog @handOk="handleSubmit" @cancel="cancel">
    <rx-layout>
      <div slot="center">
          <a-form :form="form">
            <a-form-item style="display:none">
              <a-input v-decorator="['rkId']"/>
              <a-input v-decorator="['dimId']"/>
            </a-form-item>
            <a-form-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" :label="i18n('form.relationName', '关系名')" >
              <a-input :placeholder="i18n('form.relationName', '关系名')" v-decorator="['name', {rules: [{required: true, message:i18n('form.relationName', '关系名','input')}]}]"/>
            </a-form-item>
            <a-form-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" label="Key:">
              <a-input placeholder="Key" v-decorator="['key', {rules: [{required: true, message: $ti18('rxDecorator.input','','请输入')+'Key'}]}]"/>
            </a-form-item>
            <a-form-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" :label="i18n('form.level', '级别')">
              <a-input-number :max="1000000" :min="0" :placeholder="i18n('form.level', '级别')" v-decorator="['level', {rules: [{required: true, message:i18n('form.level', '级别','input')}]}]"/>
            </a-form-item>
          </a-form>
      </div>
    </rx-layout>
  </rx-dialog>

</template>
<script>
import OsRankTypeApi from '@/api/user/org/osRankType'
import { RxLayout ,BaseForm,RxDialog} from "@lowcode/jpaas-common-lib"

export default {
  name: 'OsRankTypeEdit',
  mixins:[BaseForm],
  props:["dimId"],
  components: {
    RxLayout,
    RxDialog
  },
  data () {
    return {

    }
  },
  methods: {
      i18n(name, text, key) {
          return this.$ti18(name, text, "osDimension", key);
      },
    onload_(values){
      if(!values){
        this.mdl=Object.assign({dimId:this.dimId});
        this.form.setFieldsValue(this.mdl);
      }
    },
    get(id){
      return OsRankTypeApi.get(id);
    },
    save(values){
      return OsRankTypeApi.save(values);
    }
  }
}
</script>
